const express = require('express')
let common = require('../../index.js')

const app = express()

app.get('/', (req, res) => {
    let time = common.getRandom(500, 2000);
    let params = req.query;
    let startTime = Date.now();
    console.log('第' + params.x + '个任务 开始', startTime);
    setTimeout(() => {
        let endTime = Date.now();
        console.log('第' + params.x + '个任务 结束', startTime, '耗时' + (endTime - startTime));
        res.send('use time-->' + time)
    }, time);
})

app.listen(7895, () => {
    console.log('接口运行在 7895 端口');
})